Tuesday, March 27, 2007

Coding Misadventures - what not to do in C programming

I have been programming for many years now, and I have occasionally claimed that I am an artist at heart, and a software professional by chance. Having said that, I must add that this chance has given me the "dubious" opportunity to encounter many interesting problems, which required hours of debugging, to find an amazingly simple solution.

I have primarily worked with C/CPP on UNIX so far, where I have come across problems that baffled many, for a long time, but the final solution turned out to be trivial, even plain common sense in many cases. These might interest [or perhaps even help] people who are programming in C or in any other language. I have been thinking over publishing some of my mis-adventures in this area, but "Idle Thoughts" does not seem to be the right place for it - they are not really thoughts, idle or otherwise.

Finally, I took the plunge, and created a new blog - Coding Misadventures. In this new blog, I am going to post programming problems as and when I come across them. And I would like to invite interested people to share their experiences, or be a contributor, if they like to.

Saturday, March 24, 2007

Down the memory lane - VII

How many neurons ?

The first year of my engineering, we studied generic courses, not specific to respective departments. In the first class in the second year, one enthusiastic teacher sought to introduce the naive students in front of him to the world of computers, and parallel processing. To give a perspective on processing, he asked the class, "How many neurons does a human brain have ?". The entire class of 60 remained silent [whether out of ignorance or intimidation, I do not know]. The teacher repeated the question. The class stayed mum. And then, the only 'surd' in our class, a certain D.S., raised his hands, stood up confidently, and said, "Sir, four". The whole class roared with laughter when the teacher cited the correct answer.
After the class, we exclaimed, "Sardar ne apne gin kar bata diye" [D.S. counted his own and gave the answer!!]
The story soon spread amongst the entire batch, and whosoever heard it laughed his head off. D.S. was a very soft-spoken, and likeable fellow; but for the rest of the three years we teased him no end about this incident.

P.S. I have not quoted the correct answer here on purpose. I challenge you to answer it! With no help from google!! [or from D.S., for that matter!!!] :-)

Friday, March 23, 2007

Para 5/123

I am tagged again. This time by Observer.
I am require to publish the 5th paragraph of the page number 123 of the book I am reading. He had to get back to his tagger to ask what if the page do not have 5th paragraph and answer was , the last paragraph in that case. So I asked him what if the book I am reading does not have 123 pages. :-) The answer, as I expected was - the last page in that case.

I am currently reading "The Life of Pi" by Yann Martel. Page no. 123 does not have 5 paras, so here is the last para:
Clouds that gathered where ships were supposed to appear, and the passing of the day, slowly did the job of unbending my smile. It is pointless to say that this or that night was the worst of my life. I have so many bad nights to choose from that I've made none the champion. Still, that second night at sea stands in my memory as one of the [exceptional suffering].

And now I have to tag other five. Do not despair, people - this is an easy one!! So, I tag:

Cuckoo [my favorite target]
Prashanth [tit for tat ?]
Leziblogger [another favorite - I dont want him to keep idling]
Adi [whatever has happened to him - he wasn't one to idle]
Maverick [he, too, wasnt one to idle about]


publish the 5th/last paragraph of the 123rd/last page
of the book you are reading and tag 5 more!

Tuesday, March 20, 2007

Photography competition

There is a photography competition at my work place - and the theme is "flowers". The catch is, each participant can submit a maximum of three photographs.

Now, I am well aware that am no great photographer, but I would still like to participate in the contest. I prefer to be honest, so I do not like to download pictures from the net [as some people are known to have done in earlier contests]. So, I browsed my hard disk, and dug out all the "fairly ok" flower photos, and then proceeded to make a selection. I managed to "shortlist" six photos, but am having a difficult time creating the "final selection" of three!

I have posted most of these on my travel blog, but all the same, the selection is here for viewing pleasure :-)







Saturday, March 17, 2007

The Price of Privacy

In their interviews and statements, celebrities go on claiming endlessly that they have had to pay a huge price for their "fame" - their privacy [though I suspect that most of them enjoy, or in some cases, desperately try, to be in the limelight]. But what I want to ask is, what is the price of this so-called privacy?

Special events - weddings to be most specific - in the lives of celebrities, specially of those in the business of entertainment, are keenly followed by a section of masses [I really wonder, why?]. These celebrities will have different events of their wedding in different, exclusive locales, in luxurious [though I feel that luxury is too mild a word for it] style. The event is attended only by "immediate family and close friends". And then - they sell the "exclusive rights" of the event to a media company!! For an exorbitantly large amount !! Perhaps the buyer is indeed their closest friend, at least for the moment - he is providing the much needed moolah that allows them to afford such super-luxuries.

Point in case - two large profile weddings - one that has already taken place [Liz Hurley and Arun Nayar], and one that is eagerly awaited [Ash and Abhisek]. Liz and Nayar sold the rights for filming the wedding to "?" [sorry I do not know the name; I am not a part of the above mentioned section of the masses - I am only made aware of it because the newspapers thrust the news under my eyes]. And now we hear that the rights for Ash-Abhishek wedding has been sold to "a foriegn media company" for "an undisclosed amount".

Selling everything from Tag Heur watches to 'Navratan tel' is one thing ... but this - have they named a price for their self? Because, I feel that this amounts to selling oneself - these stars have made themselves a commodity. But that is not the question. The question is - why do they then shout themselves hoarse, cribbing that the media allows them no privacy?

Yeh Baatei.n ...

Finally, I found a digital version of the nazm "Yeh baatei.n jhoothi baatei.n hai.n" through the generosity of a kind soul - a colloeague of mine, who is the greatest ghazal aficiando I have ever seen or heard of. Name any ghazal, and he would have read it, and most likely have one or more digital versions of it - I asked him for an mp3 of this ghazal; he gave me two - by Ghulam Ali and Abida Parveen!! I listened to both, but I liked the Ghulam Ali version better, though it wasn't as good as the live show!! For the last week, I have been listening to it three or four or more times a day [in office, on speaker, but after regular work hours] - thankfully my neighbor [the person who sits in the cubicle next to mine] is not averse to ghazals :-D

I had meaning to post the lines I liked best from a collection of ghazals by Dushyant Kumar. But the book was borrowed by a colleague, who although has read it, is now re- and re-re- reading it. While my post(s) on 'Saye mei.n dhoop' may be delayed, in the meanwhile, I will just quote the sher I (perhaps) liked best -

Yahaa.n darakhto.n ke saaye mei.n dhoop lagti hai
Chalo yahaa.n se chalei.n umra bhar ke liye ....

[Here, the shade of trees cannot protect you from the heat of the sun
Let us leave this place for ever ...]

Darakht - a big, dense tree - representing a caring, protective entity - perhaps a government for a citizen, or a family for an individual - if it fails to provide the support that is expected, there is no point in relying on it .....

Sunday, March 11, 2007

Tarqash - III

Okay! The final post on Tarqash ..... some more 'ashaar' ...
Two of these ashaar are from a ghazal [Mujhko yaqii.n hai] that has been sung by Jagjit Singh, and has been very popular ... perhaps everyone who is interested in ghazals would have heard it, but I am still including these, because they are undoubtedly beatiful!

***

Aksar woh kahte hai.n woh bas mere hai.n
Aksar kyu.n kahte hai.n hairat hoti hai

Tab ham dono.n waqt chura kar laate the
Ab milte hai.n jab bhi fursat hoti hai

Apni mehbooba mei.n apni maa.n dekhei.n
Bin maa.n ke laDko.n ki fitrat hoti hai

***

Gairo.n ko kab fursat hai dukh dene ki
Jab hota hai koii hamdam hota hai

***

Mujhko yaqii.n hai sach kahti thii.n jo bhi ammi kahti thii.n
Jab mere bachpan ke din the chaand mei.n pariyaa.n rahti thii.n

Ek yeh ghar jis ghar mei.n mera saazo-saamaa.n rahta hai
Ek woh ghar jis ghar mei.n meri booDhi naani rahti thii.n

***

Agar palak pe hai moti to yeh nahi.n kaafi
Hunar bhi chaahiye alfaaz mei.n pirone ka

Jo fasl khwaab ki tayyaar hai to yeh jaano
Ki waqt aa gayaa phir koii dard bone ka

***

Thursday, March 08, 2007

Tarqash - II

Though I did intend to share more excerpts from Tarqash, BTR and Cuckoo have urged me to do so - the sooner the better :-)

But before I come to that, I want to share something that would interest most of the people who come to my blog -
Anyone who has the slightest, passing, interest in hindi movies, would not have failed to listen to the immortal song from the movie 'Silsila' - "Mai.n aur meri tanhaaii". Did you know that the following lines used in this song are from Akhtar's poem 'Banjara' [quoted in previous post]:
Tum hotii to kaisaa hota
Tum yeh kahti, tum woh kahti
Tum is baat pe hairran hoti, tum us baat pe kitni hansti
Tum hoti to aisa hota, tum hoti to vaisa hota.

And the following lines form a 'Qataa' [Qataa is a composition consiting of four lines, as opposed to a 'sher', which consists of two lines]:
Katthaii aankho.n wali ek ladki
Ek hi baat pe bigaDti hai
Tum mujhe kyu.n nahi.n mile pahle
Roz kah kar mujhse laDti hai

And finally, a few 'ashaar' from some of the ghazals:

***
Baato.n mei.n dosti ka amrit, siine mei.n zahar nafrato.n ka
Parbat pe phool khil rahe hai.n baitha hai gaar mei.n darinda

***
Jo mujhko zinda jala rahe hai.n woh bekhabar hai.n
Ki meri zanjeer dhire dhire pighal rahi hai

Mai.n qatl to ho gaya tumhari gali mei.n lekin
Mere lahoo se tumhari diivar gal rahi hai

Na jalne paate the jinke jiske choolhe bhi har savere
Suna hai kal raat se woh basti bhi jal rahi hai

***
Khwab ke gaanv mei.n pale hai.n ham
Paani chhalni mei.n le chale hai.n ham

***

Cheers
Have a great weekend!!

Wednesday, March 07, 2007

Tarqash

Tarqash, a collection of poems by Javed Akhtar was highly recommended to me. It featured in the "Next in my reading list" for quite some time before I was able to find a copy. After searching for it in the few local bookstores, I managed to get a copy a few days back. I also found a collection of ghazals, titled "Saye mein dhoop" by Dushyant Kumar the same day. [Was it my lucky day? ;-) ]

The first part of the book is a brief autobiography. It is great to read about the life and struggle of the famous poet and lyricist. But what I admire is the very casual language and tone it is written in. It is the language one would use in conversation, interspersed with humour - and not a monotonous prose one would expect from a literary genius. Really worth reading.

Next comes the preface - an introduction of the poet, and of the poems in the collection, written by Qurtul En Haidar. This is what I call heavy prose. The style, and use of rather tough urdu words [even though the meaning was given at the bottom of the page] made it difficult to read. I felt that the tough urdu words, and some english words written in devanagri script, rather broke the flow.

The collection includes 24 poems and 23 ghazals and some 'ashaar'.
I liked the poems, though I did not appreciate them too much, because I prefer poem with a rhythm and rhyme. And in some cases, I felt that the poem was too long for the central idea conveyed in it. But most of them presented a very stark image of the struggles of an individual - and it does not appear to be an outsider's view - but a narration from a person who had gone through it, who has felt the pain.
I like ghazals, primarliy because of the rhythm :-) My observation about ghazals in this collection is that the statements made are more generic - a commentary on the society in general.

Here are a few excerpts from some poems ....
[The translation, as usual, is mine :-)]

***
Gin gin ke sikke haath mera khurdura hua
Jaati rahi woh lams ki narmi bura hua

Counting the coins, my hands have become rough
It is unfortunate that the softness of touch is lost

***
[Banjara]

Tum ne mujhko choDa tha jis shahar mei.n aake
Waqt ka ab woh shahar bhi mujhse choot raha hai
...
Woh saare din
Jinke kandhe par soti hai
Ab bhi tumhari julf ki khushboo

[Nomad]

In the city where you had separated from me
Now I have to leave that city of time too
...
All those days
On whose shoulders still sleep
The fragrance of your tresses

***

[Ek mohre ka safar]

Yu.n woh ik roz baDa mohra bana
Ab woh mehfooz hai ik khane mei.n
Itna mehfooz ki dushman to alah
Dost bhi paas nahi.n aa sakte

[The journey of a chess piece]

An thus, he became a mightier chesspiece
And now he is safe in his square
So very safe, that not only his foes
Even his friends can no longer reach him

***

Tuesday, March 06, 2007

Yeh Baatei.n Jhoothi Baatei.n hai.n

In the post on Ghulam Ali concert, I mentioned the nazm I liked most was one by Ibn-e-Insha. I tried to find the poem on the net, but it proved to be difficult - I just found one source for it.

Here is the poem. If anyone is aware of any inaccuracies/incompleteness, please let me know ....

Yeh Baatei.n Jhoothi Baatei.n Hai.n....

Yeh Baatei.n Jhoothi Baatei.n Hai.n, Yeh logo.n Nay Phailaaii Hai.n
Tum Insha Ji Ka Naam Na Lo Kya Insha Ji Saudai Hai.n

Hai.n Laakho.n Rog Zamanay Mei.n Kyo.n Ishq hai Ruswa Bechara
Hai.n Aur Bhi Wajhei.n Wehshut Ki Rakhti Ji ko Dukhiyaara
Haa.n Bekal Bekal Rehta Hai Wo Preet Mein jis Nay Ji Haara
Per Subah Se Le Kar Shaam Talak Yo.n Kaun Phirega Awara
Yeh Baatei.n Jhoothi Baatei.n hei.n Yeh Logo.n Nay Phailaii hai.n
Tum Insha ji Ka naam Na Lo Kia Insha Ji Saudaaii Hai.n

Gar Ishq Kiya Hai Tab Kiya Hai, Kyo.n Shaad Nahi.n Aabaad Nahi.n
Jo Jaan Liye Bin Tal na Sakay Yeh Aisi Bhi Uftaad Nahi.n
Yeh Baat To Tum Bi Maanoge wo Qais Nahi.n Farhaad Nahi.n
Kya Hijr Ka Daaroo Mushkil Hai Kya Vasl Ke Nuskhay Yaad Nahi.n
Yeh Baatei.n Jhoothi Baatei.n hai.n Yeh Logo.n Nay Phailaii hai.n
Tum Insha ji Ka naam Na Lo Kya Insha Ji Saudaaii Hai.n

Wo Larki Aachi Larki Hei, Tum Naam Na Lo Hum Jaan Gaye
Wo Jis Ke Lambay Gesoo Hai.n, Pehchaan Gaye Pehchaan Gaye
Haa.n Saath Hamaaray Insha Bhi Us Ghar Mei.n Thay Mehmaan Gaye
Par Us Se To Kuch Baat na Ki, Anjaan Rahe Anjaan Gaye
Yeh Baatei.n Jhoothi baatei.n Hai.n, Yeh Logo.n Nay Phailaii Hai.n
Tum insha Ji Ka Naam Na Lo, Kiya Insha Ji Saudaii Hai.n

Jo Hum Se Kaho Hum Kartay Hai.n, Kya Insha Ko Samjhaana Hai
Us Larki Se Bhi Keh Lenge, Go Ab Kuch Aur Zamaana Hai
Ya Chorei.n Ya Takmeel Karei.n, Yeh Ishq Hei Ya Afsaana Hai
Yeh Kaisa Gorakh Dhandha Hei, Yeh Kaisa Taana Baana Hai
Yeh Baatei.n Jhoothi Baatei.n hai.n, Yeh Logo.n Nay Phailaii Hai.n
Tum Insha Ji Ka Naam Na Lo, Kiya Insha Ji Saudaii Hai.n